package com.example.a44786.myapplication;

import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTabHost;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;




public class kuang2Activity extends AppCompatActivity{
    private FragmentTabHost tabHost;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_kuang2);
        init();
       setTab();
    }
    public void init(){
        tabHost=(FragmentTabHost)findViewById(R.id.tabHost);
    }
    public void setTab(){
        FragmentManager fragmentManager=getSupportFragmentManager();
        tabHost.setup(this,fragmentManager,R.id.tablocation);
        tabHost.getTabWidget().setDividerDrawable(null);
        tabHost.addTab(tabHost.newTabSpec("shishijiankong").setIndicator(setTabview("测试1")),disi1.class,null);
        tabHost.addTab(tabHost.newTabSpec("shishijiankong").setIndicator(setTabview("测试1")),tab2.class,null);
        tabHost.addTab(tabHost.newTabSpec("shishijiankong").setIndicator(setTabview("测试1")),tab2.class,null);
        tabHost.addTab(tabHost.newTabSpec("shishijiankong").setIndicator(setTabview("测试1")),tab2.class,null);

    }
    public View setTabview(String title){
        View view=LayoutInflater.from(this).inflate(R.layout.ceshi2,null);
        TextView textView=(TextView)view.findViewById(R.id.tabtool_textview_title);
        textView.setText(title);
        return view;

    }

    public void onClick(View view) {
        setContentView(R.layout.activity_tab5);
    }
    public void onClick2(View view) {
        setContentView(R.layout.activity_tab6);
    }
    public void onClick3(View view) {
        setContentView(R.layout.activity_tab7);
    }
    public void onClick4(View view) {
        setContentView(R.layout.activity_tab8);
    }
}
